﻿using JT808Protocol.Common;
using JT808Protocol.Models.Enums;
using System;
using System.Collections.Generic;

namespace JT808Protocol.Models.BodyParserStrategy.Control
{
    /// <summary>
    /// 文本信息下发
    /// </summary>
    public class PrTextSend_0x8300 : IJT808Body
    {
        /// <summary>
        /// 文本信息标志位
        /// </summary>
        public EnumTextSendFlag Flag { get; set; }

        /// <summary>
        /// 文本信息
        /// </summary>
        public string Text { get; set; }

        public override IJT808Body ReadBody(ReadOnlySpan<byte> data, ref int index)
        {
            throw new NotImplementedException();
        }

        public override List<byte> WriteToBytes()
        {
            List<byte> bytes = new List<byte>();

            bytes.Add((byte)Flag);
            bytes.AddRange(ParseHelper.GbkBytes(Text));

            return bytes;
        }
    }
}